package it.unical.mat.aec.manageResult;

import it.unical.mat.aec.model.Test;

import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.FileReader;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.ArrayList;

public class EsportaTestsTxT extends EsportaTests {

	public EsportaTestsTxT() {
		super();
	}

	@Override
	protected File esportaTests(ArrayList<Test> tests, String path)
			throws FileNotFoundException {
		File file = new File(path);
		PrintWriter print = new PrintWriter(file);
		print.write("Matricola|    Studente  | Punteggio | Esito \n");
		for (Test t : tests) {
			print.write(t.getStudente().tooString() + " |" + t.getPunteggio()
					+ "|");
			if (t.getPunteggio() > 18)
				print.write("Superato \n");
			else
				print.write("Non Superato \n");
		}
		print.close();
		return file;
	}

}
